﻿namespace K9Nano.Updater;

public interface IUpdateClient
{
    /// <summary>
    /// 获取最新版本
    /// </summary>
    /// <returns></returns>
    Task<AvailableVersion?> GetLatestVersionAsync(CancellationToken cancellation = default);

    /// <summary>
    /// 获取版本元数据
    /// </summary>
    /// <param name="version"></param>
    /// <returns></returns>
    Task<ReleaseMetadata?> GetReleaseMetadataAsync(Version version, CancellationToken cancellation = default);

    /// <summary>
    /// 下载文件
    /// <param name="version">目标版本号</param>
    /// <param name="fileUri">文件名称</param>
    /// <param name="targetPath">下载存放路径</param>
    /// <param name="progressCallback">进度回调</param>
    /// </summary>
    Task DownloadAsync(Version version, string fileUri, string targetPath, Action<double>? progressCallback = null, CancellationToken cancellation = default);
}
